<template>
	<!-- 量化分级-星级展示 -->
	<view class="">
		<!-- 头部 -->
		<lhfj-header currentNav="2" @search="search"></lhfj-header>
		<!-- 企业风采展示 -->
		<view class="section">
			<view class="section-title-bar">
				<u-section title="企业风采展示" sub-title="更多>>" :font-size="sectionFontSize" :bold="sectionBold" :show-line="false"
					:arrow="false" @click="toList('fczs')"></u-section>
			</view>
			<view class="home-qyfczs-content grid-bar">
				<view class="home-qyfczs-content-item grid-item2" v-for="(item, index) in companyList" :key="index"
					@click="toDetail('fczs', item.id)">
					<image :src="item.images" mode=""></image>
				</view>
			</view>
		</view>
		<!-- 评定公示 -->
		<view class="section">
			<view class="section-title-bar">
				<u-section title="评定公示" sub-title="更多>>" :font-size="sectionFontSize" :bold="sectionBold" :show-line="false"
					:arrow="false" @click="toList('pdgs')"></u-section>
			</view>
			<view class="list-bar">
				<view class="list-item" v-for="(item, index) in pdgsList" :key="index"
					@click="toDetail('pdgs', item.id)">
					<text class="dot">●</text>
					<text class="text common-text">{{item.title}}</text>
				</view>
			</view>
		</view>
		<!-- 底部 -->
		<lhfj-footer></lhfj-footer>
	</view>
</template>

<script>
	import config from "@/app.config.js";
	import DEMO_COMPANY from "@/data/demoCompany.js";
	import DEMO_PDGS from "@/data/demoPdgs.js";

	export default {
		data() {
			return {
				keyword: '',
				
				companyList: [], // 企业风采展示
				pdgsList: [], // 评定公示
				
				sectionFontSize: this.$css.sectionFontSize,
				sectionBold: this.$css.sectionBold,
			}
		},
		onLoad(options = {}) {
			this.initPage(options);
		},
		methods: {
			initPage(options) {
				this.getCompanyList();
				this.getPdsgList();
			},
			pageTo(path) {
				vk.navigateTo(path);
			},
			search(data){
				this.keyword = data.keyword;
				vk.toast('搜索关键字 = ' + this.keyword);
			},
			toList(nav){
				let path;
				if(nav == 'fczs'){
					this.pageTo('./fczs/list')
				}else if(nav == 'pdgs'){
					vk.toast(`点击了评定公示更多`);
				} else{
					vk.toast(`点击了${nav}` + ' XXXX 未开发');
					return;
				}
				// this.pageTo(path)
			},
			toDetail(nav, id){
				let path, obj;
				if(nav == 'fczs'){
					path = './fczs/detail';
					obj = this.companyList.find(item => item.id == id);
				}else if(nav == 'pdgs'){
					path = '/pages/common/single';
					obj = this.pdgsList.find(item => item.id == id);
				} else{
					vk.toast(`点击了${nav}【${id}】` + ' XXXX 未开发');
					return;
				}
				this.$tools.pageTo(path, obj);
			},
			// 读取企业列表
			getCompanyList() {
				this.companyList = DEMO_COMPANY.filter((item, index) => index<=3);
			},
			// 读取评定公示列表
			getPdsgList() {
				this.pdgsList = DEMO_PDGS;
			},
		},
		// 监听器
		watch: {

		},
		// 计算属性
		computed: {

		},
		// 监听 - 页面下拉刷新
		onPullDownRefresh() {
			setTimeout(() => {
				this.initPage();
				uni.stopPullDownRefresh();
			}, 1000);
		},
	}
</script>

<style lang="scss">
	.list-bar{
		margin: auto;
		width: 90%;
	}
	.list-item{
		font-size: 14px;
		color: #43618B;
	}
	.list-item .dot{
		padding: 0 10rpx;
	}
	.list-item .text{
		
	}
</style>